<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .box {
      width: 500px;
      height: 300px;
       background-color: #ccc;
       display: flex;
    }
    /* 子类的flex属性其实有三个，默认flex:flex: 0 1 auto
    flex-grow 
flex-shrink -- 
flex-basis */
flex-grow

/* 默认0，用于决定项目在有剩余空间的情况下是否放大，默认不放大；注意，即便设置了固定宽度，也会放大。 */
    .d1 {
      flex-grow: 0;
      background-color: red;

    }
    .d2 {
      /* 左右flex-grow=0,中间1则占满中间 */
      flex-grow: 1; 
      width: 50px;
      background-color: yellow;

    }
    .d3 {
      flex-grow: 0;
      background-color: blue;
  
    }
  </style>
</head>
<body>
  <div class="box">
    <div class="d1">1</div>
    <div class="d2">2</div>
    <div class="d3">3</div>
  </div>
</body>
</html>